//package com.inspur.edp.bff.designtime.generator.core.mgrimpl;
//
//import com.fasterxml.jackson.core.JsonProcessingException;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.inspur.edp.bff.api.attribute.ChangeConvertorAttribute;
//import com.inspur.edp.bff.api.attribute.DataConvertorAttribute;
//import com.inspur.edp.bff.api.attribute.DefaultValueConvertorAttribute;
//import com.inspur.edp.bff.api.attribute.EntityPropertyMapperAttribute;
//import com.inspur.edp.bff.api.attribute.ExtendActionAttribute;
//import com.inspur.edp.bff.api.attribute.FilterConvertorAttribute;
//import com.inspur.edp.bff.api.attribute.SourceConfigAttribute;
//import com.inspur.edp.bff.api.attribute.VMDataExtendAttribute;
//import com.inspur.edp.bff.designtime.generator.core.VmCoreGenContext;
//import com.inspur.edp.bff.designtime.generator.core.mgrimpl.extendprovider.CtmExtendProviderGenerator;
//import com.inspur.edp.bff.spi.AbstractDefaultValueConvertor;
//import com.inspur.edp.bff.spi.AbstractFSManager;
//import com.inspur.edp.caf.generator.BaseGenerator;
//import com.inspur.edp.caf.generator.baseInfo.AnnotationInfo;
//import com.inspur.edp.caf.generator.baseInfo.AnnotationType;
//import com.inspur.edp.caf.generator.baseInfo.TypeInfo;
//import com.inspur.edp.caf.generator.method.ClassMethodGenerator;
//import com.inspur.edp.cef.entity.config.MgrConfig;
//import com.inspur.edp.cef.gencommon.MediateType;
//import com.inspur.edp.cef.generator.coreGenerator.base.mgrGenerator.MgrInplGenCtx;
//import com.inspur.edp.cef.generator.coreGenerator.entityGenerator.mgrGenerator.EntityMgrImplGenerator;
//import com.inspur.edp.das.commonmodel.IGspCommonModel;
//import com.inspur.edp.formserver.viewmodel.action.MappedBizAction;
//import com.inspur.edp.formserver.viewmodel.action.MappedCdpAction;
//import com.inspur.edp.formserver.viewmodel.action.ViewModelAction;
//
//import java.util.ArrayList;
//import java.util.HashMap;
//
//import lombok.var;
//import org.eclipse.jdt.core.dom.Expression;
//import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
//import org.eclipse.jdt.core.dom.StringLiteral;
//import org.eclipse.jdt.core.dom.TypeLiteral;
//
//public class VmMgrImplGenerator extends EntityMgrImplGenerator {
//
//  //region Basic Info
//
//
//  //region Static Members
//  private static final String NameSuffix = "VmManager";
//
//  public VmMgrImplGenerator(VmCoreGenContext coreGenCtx) {
//    super(coreGenCtx);
//
//  }
//
//  public static String getName(IGspCommonModel model) {
//    return model.getCode() + NameSuffix;
//  }
//
////  public static String getNamespace(IGspCommonModel model) {
////    return VmCoreHelper.GetNamespace(model);
////  }
//
//  //protected override List<Type> addParentClasses()
//  //{
//  //    return new List<Type> { typeof(AbstractFSManager) };
//  //}
//
//  private VmCoreGenContext getCoreGenCtx() {
//    return (VmCoreGenContext) getCoreGenContext();
//  }
//
//  @Override
//  protected java.util.ArrayList<ModifierKeyword> getAccessModifier() {
//    return new java.util.ArrayList<ModifierKeyword>(
//        java.util.Arrays.asList(new ModifierKeyword[]{ModifierKeyword.PUBLIC_KEYWORD}));
//  }
//
//  @Override
//  protected java.util.ArrayList<TypeInfo> addParentInterfaces() {
//    return new java.util.ArrayList<TypeInfo>(java.util.Arrays
//        .asList(new TypeInfo[]{getCoreGenCtx().getVmGenContext().getVmMgrInterfaceType()}));
//  }
//
//  @Override
//  protected java.lang.Class getImplParentClassType() {
//    return AbstractFSManager.class;
//  }
//
//  @Override
//  protected void beforeInitialize() {
//    super.beforeInitialize();
//    getCoreGenCtx().getVmGenContext().setVmMgrImplClassName(getFullName());
//  }
//
//  private String getFullName() {
//    return compileUnit.getPackageName() + "." + getName();
//  }
//
//  //endregion
//
//  //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods are not converted by C# to Java Converter:
//  @Override
//  protected String getName() {
//    return getName(getCoreGenCtx().getVmGenContext().getVm());
//  }
//
//  //endregion
//
////  @Override
////  protected String getNameSpace() {
////    return GetNamespace(getCoreGenCtx().getVmGenContext().getVm());
////  }
//
//  @Override
//  protected void afterGenerate() {
//    super.afterGenerate();
//    getCoreGenCtx().setVmMgrImplType(new MediateType(compileUnit.getPackageName(), getName()));
//  }
//
//
//  //region Child Generators
//  @Override
//  protected java.util.ArrayList<ClassMethodGenerator> getMgrActionGenerators() {
//    java.util.ArrayList<ClassMethodGenerator> methodGenerators = new java.util.ArrayList<ClassMethodGenerator>();
////C# TO JAVA CONVERTER TODO TASK: There is no equivalent to implicit typing in Java:
//    for (ViewModelAction vmAction : getCoreGenCtx().getVmGenContext().getVm().getActions()) {
//      switch (vmAction.getType()) {
//        case BEAction:
//          BeActionMethodGenerator gen = new BeActionMethodGenerator(
//              (MappedBizAction) ((vmAction instanceof MappedBizAction) ? vmAction : null),
//              getCoreGenCtx().getVmGenContext(),
//              getCoreGenCtx().getVmGenContext().getMetadataPool());
//          methodGenerators.add(gen);
//          break;
//        case VMAction:
//          VmActionMethodGenerator vmActionGen = new VmActionMethodGenerator(
//              (MappedCdpAction) vmAction, getCoreGenCtx().getVmGenContext().getMetadataPool(),
//              getCoreGenCtx());
//          methodGenerators.add(vmActionGen);
//          break;
//      }
//    }
//
//    return methodGenerators;
//  }
//  //endregion
//
//  //region NonOfUse
//  @Override
//  protected void doInitialize() {
//  }
//  @Override
//  protected ArrayList<BaseGenerator> createClassExtendChildGenrators() {
//    var list = super.createClassExtendChildGenrators();
//    if(list == null)
//      list = new ArrayList<BaseGenerator>();
//    if(getCoreGenCtx().getVmGenContext().getMetadata().getHeader().isExtendable())
//      list.add(new CtmExtendProviderGenerator(getCoreGenCtx(), (MgrInplGenCtx)getContext()));
//
//    return list;
//  }
//
//
//
//  @Override
//  protected java.util.ArrayList<AnnotationInfo> getAttributeList() {
//    boolean isVirtualVo = getCoreGenCtx().getVmGenContext().getVm().getIsVirtual();
//    java.util.ArrayList<AnnotationInfo> list = super.getAttributeList();
//    if (list == null) {
//      list = new java.util.ArrayList<AnnotationInfo>();
//    }
//    AnnotationInfo entityAttr = new AnnotationInfo();
//    entityAttr.setTypeInfo(new TypeInfo(VMDataExtendAttribute.class));
//    entityAttr.setAnnotationType(AnnotationType.Normal);
//    HashMap<String, Expression> dataExtAnnoParams = new HashMap<String, Expression>(2);
//    TypeLiteral dataTypeLiteral = ast.newTypeLiteral();
//    dataTypeLiteral.setType(getCoreGenCtx().getVmGenContext().getNodeTypes()
//        .get(getCoreGenCtx().getVmGenContext().getVm().getMainObject().getCode()).getType(ast,getCoreGenCtx()));
//    dataExtAnnoParams.put("entityDataType", dataTypeLiteral);
//    TypeLiteral serType = ast.newTypeLiteral();
//    serType.setType(ast.newSimpleType(ast.newSimpleName(String
//        .format("%1$sSerItem",
//            getCoreGenCtx().getVmGenContext().getVm().getMainObject().getCode()))));
//    dataExtAnnoParams.put("serializerType", serType);
//    entityAttr.setParams(dataExtAnnoParams);
//    list.add(entityAttr);
//
//    if(!isVirtualVo){
//      AnnotationInfo dataConvertorAttr = new AnnotationInfo();
//      dataConvertorAttr.setTypeInfo(new TypeInfo(DataConvertorAttribute.class));
//      dataConvertorAttr.setAnnotationType(AnnotationType.Normal);
//      HashMap<String, Expression> dataConParams = new HashMap<String, Expression>(1);
//      Expression convertorTypeLiteral;
//      if (isVirtualVo) {
//        convertorTypeLiteral = ast.newNullLiteral();
//      } else {
//        convertorTypeLiteral = ast.newTypeLiteral();
//        ((TypeLiteral) convertorTypeLiteral)
//                .setType(getCoreGenCtx().getVmGenContext().getDataConvertorType().getType(ast,getCoreGenCtx()));
//      }
//      dataConParams.put("convertorType", convertorTypeLiteral);
//      dataConvertorAttr.setParams(dataConParams);
//      list.add(dataConvertorAttr);
//
//      AnnotationInfo changeConvertorAttr = new AnnotationInfo();
//      changeConvertorAttr.setTypeInfo(new TypeInfo(ChangeConvertorAttribute.class));
//      changeConvertorAttr.setAnnotationType(AnnotationType.Normal);
//      HashMap<String, Expression> changeConvertorParams = new HashMap<String, Expression>(2);
//      Expression convertorTypeExpr;
//      if (isVirtualVo) {
//        convertorTypeExpr = ast.newNullLiteral();
//      } else {
//        convertorTypeExpr = ast.newTypeLiteral();
//        ((TypeLiteral) convertorTypeExpr).setType(getCoreGenCtx().getVmGenContext().getChangeConvertorType().getType(ast, getCoreGenCtx()));
//      }
//      changeConvertorParams.put("convertorType", convertorTypeExpr);
//      TypeLiteral entityTypeLiteral = ast.newTypeLiteral();
//      entityTypeLiteral.setType(getCoreGenCtx().getVmGenContext().getChangeConvertorType().getType(ast, getCoreGenCtx()));
//      changeConvertorParams.put("entityType", entityTypeLiteral);
//      changeConvertorAttr.setParams(changeConvertorParams);
//      list.add(changeConvertorAttr);
//    }
//
//
//
//    HashMap<String, Expression> changeConvertorParams1 = new HashMap<String, Expression>(2);
//    AnnotationInfo defaultConvertorAttr = new AnnotationInfo();
//    defaultConvertorAttr.setTypeInfo(new TypeInfo(DefaultValueConvertorAttribute.class));
//    defaultConvertorAttr.setAnnotationType(AnnotationType.Normal);
//    HashMap<String, Expression> defaultConvertorParams = new HashMap<String, Expression>(2);
//    TypeLiteral defaultConvertorTypeExpr= ast.newTypeLiteral();
//    if (isVirtualVo) {
//      defaultConvertorTypeExpr.setType(new TypeInfo(AbstractDefaultValueConvertor.class).getType(ast, getCoreGenCtx()));
//    } else {
//      defaultConvertorTypeExpr
//          .setType(getCoreGenCtx().getVmGenContext().GetDefaultValueConvertorType().getType(ast,getCoreGenCtx()));
//    }
//    changeConvertorParams1.put("convertorType", defaultConvertorTypeExpr);
//    TypeLiteral defaultValueEntityTypeLiteral = ast.newTypeLiteral();
//    defaultValueEntityTypeLiteral
//        .setType(getCoreGenCtx().getVmGenContext().getDefaultValueType().getType(ast,getCoreGenCtx()));
//    changeConvertorParams1.put("entityType", defaultValueEntityTypeLiteral);
//    defaultConvertorAttr.setParams(changeConvertorParams1);
//
//    list.add(defaultConvertorAttr);
//
//    AnnotationInfo extendActionAttr = new AnnotationInfo();
//    extendActionAttr.setTypeInfo(new TypeInfo(ExtendActionAttribute.class));
//    extendActionAttr.setAnnotationType(AnnotationType.Normal);
//    HashMap<String, Expression> extendActionAttrParams = new HashMap<String, Expression>(1);
//    TypeInfo typeInfo = new TypeInfo(getCoreGenCtx().getExtendActionConfigType().getClassName());
//    typeInfo.setTypePackageName(getCoreGenCtx().getExtendActionConfigType().getNamespace());
//    TypeLiteral extendActionLiteral = ast.newTypeLiteral();
//    extendActionLiteral.setType(typeInfo.getType(ast,getCoreGenCtx()));
//    extendActionAttrParams.put("extendActionConfig", extendActionLiteral);
//    extendActionAttr.setParams(extendActionAttrParams);
//    list.add(extendActionAttr);
//    addVarConfigAttribute(list);
//
//    AnnotationInfo filterConvertorAttr = new AnnotationInfo();
//    filterConvertorAttr.setTypeInfo(new TypeInfo(FilterConvertorAttribute.class));
//    filterConvertorAttr.setAnnotationType(AnnotationType.Normal);
//    HashMap<String, Expression> filterConvertorParams = new HashMap<String, Expression>();
//    TypeLiteral filterConvertType = ast.newTypeLiteral();
//    filterConvertType.setType(getCoreGenCtx().getVmGenContext().getFilterConvertorType().getType(ast,getCoreGenCtx()));
//    filterConvertorParams.put("convertorType", filterConvertType);
//    filterConvertorAttr.setParams(filterConvertorParams);
//    list.add(filterConvertorAttr);
//
//    AnnotationInfo sourceAttr = new AnnotationInfo();
//    sourceAttr.setTypeInfo(new TypeInfo(SourceConfigAttribute.class));
//    sourceAttr.setAnnotationType(AnnotationType.Normal);
//    HashMap<String, Expression> sourceAttrParams = new HashMap<String, Expression>();
//    TypeLiteral sourceAttrType = ast.newTypeLiteral();
//    TypeInfo sourceConfigType = new TypeInfo(getCoreGenCtx().getSouceConfigType().getClassName());
//    sourceConfigType.setTypePackageName(getCoreGenCtx().getSouceConfigType().getNamespace());
//    sourceAttrType.setType(sourceConfigType.getType(ast,getCoreGenCtx()));
//    sourceAttrParams.put("configType", sourceAttrType);
//    sourceAttr.setParams(sourceAttrParams);
//    list.add(sourceAttr);
//
//    MediateType entityMapperType = getCoreGenCtx().getRootEntityPropMapperType();
//    if(entityMapperType != null) {
//      AnnotationInfo entityMapperAttr = new AnnotationInfo();
//      entityMapperAttr.setTypeInfo(new TypeInfo(EntityPropertyMapperAttribute.class));
//      entityMapperAttr.setAnnotationType(AnnotationType.SingleMember);
//      TypeLiteral type = ast.newTypeLiteral();
//      type.setType(new TypeInfo(getCoreGenCtx().getRootEntityPropMapperType().getFullName())
//          .getType(ast, getCoreGenCtx()));
//      entityMapperAttr.setSingleParam(type);
//      list.add(entityMapperAttr);
//    }
//
//    return list;
//
//    //endregion
//  }
//
//  private void addVarConfigAttribute(java.util.ArrayList<AnnotationInfo> attributes) {
//    if (getCoreGenCtx().getVmGenContext().getVm().getVariables()== null) {
//      return;
//    }
//
//    MgrConfig tempVar = new MgrConfig();
//
//    tempVar.setAllInterfaceClassName(getCoreGenCtx().getVmGenContext().getVarGenCtx()
//            .getMgrAllInterfaceType().getFullName());
//
//    tempVar.setClass(getCoreGenCtx().getVmGenContext().getVarGenCtx().getMgrInterfaceType().getFullName());
//
//    tempVar.setImpClass(getCoreGenCtx().getVmGenContext().getVarGenCtx().getMgrImplType().getFullName());
//
//    String configValue = null;
//    try {
//      configValue = new ObjectMapper().writeValueAsString(tempVar);
//    } catch (JsonProcessingException e) {
//      throw new RuntimeException(e);
//    }
//    AnnotationInfo tempVar2 = new AnnotationInfo();
//    TypeInfo annotationType = new TypeInfo("VarConfigAttribute");
//    annotationType.setTypePackageName("com.inspur.edp.cef.api.attr");
//    tempVar2.setTypeInfo(annotationType);
//    tempVar2.setAnnotationType(AnnotationType.Normal);
//
//    StringLiteral value = ast.newStringLiteral();
//    value.setLiteralValue(configValue);
//    tempVar2.getParams().put("configStr",value);
//
//    attributes.add(tempVar2);
//  }
//
////  private String getConfigString() {
////    MgrConfig tempVar = new MgrConfig();
////    tempVar.AllInterfaceAssembly = getCoreGenCtx()
////        .getVmGenContext().MetadataJitContext.ProjectInfoList[0].AssemblyName;
////    tempVar.Assembly = getCoreGenCtx()
////        .getVmGenContext().MetadataJitContext.ProjectInfoList[0].AssemblyName;
////    tempVar.AllInterfaceClassName = getCoreGenCtx().getVmGenContext()
////        .getVarGenCtx().MgrAllInterfaceType.FullName;
////    tempVar.Class = getCoreGenCtx().getVmGenContext().getVarGenCtx().MgrInterfaceType.FullName;
////    tempVar.ImpAssembly = getCoreGenCtx()
////        .getVmGenContext().MetadataJitContext.ProjectInfoList[1].AssemblyName;
////    tempVar.ImpClass = getCoreGenCtx().getVmGenContext().getVarGenCtx().MgrImplType.FullName;
////    MgrConfig config = tempVar;
////    return Serializer.JsonSerialize(config);
////  }
//}